# Group Services

**ADMIN**

To get or modify data of this data layer, you will need admin access. You can get the data without admin access as well.

| Parameter | Description | Type | Required |
|:----------|-------------|------|----------|
| `name`  | Name of the service | string | **yes** |

## Services Collection [/v1/services{?page%5bsize%5d,page%5bnumber%5d,sort,filter}]
+ Parameters
    + page%5bsize%5d (optional, integer, `10`) - Maximum number of resources in a single paginated response.
    + page%5bnumber%5d (optional, integer, `2`) - Page number to fetched for the paginated response.
    + sort (optional, string, `name`) - Sort the resources according to the given attribute in ascending order. Append '-' to sort in descending order.
    + filter (optional, string, `[]`) - Filter according to the flask-rest-jsonapi filtering system. Please refer: http://flask-rest-jsonapi.readthedocs.io/en/latest/filtering.html for more.

### List Services [GET]
Get a list of Services.

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)

        {
            "meta": {
                "count": 1
            },
            "data": [
                {
                    "attributes": {
                        "name": "track"
                    },
                    "type": "service",
                    "id": "1",
                    "links": {
                        "self": "/v1/services/1"
                    }
                }
            ],
            "jsonapi": {
                "version": "1.0"
            },
            "links": {
                "self": "/v1/services"
            }
        }


## Services Details [/v1/services/{service_id}]
+ Parameters
    + service_id: 1 (integer) - ID of the service in the form of an integer

### Get Service Details [GET]
Get a single role.

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)

        {
          "data": {
            "attributes": {
              "name": "track"
            },
            "type": "service",
            "id": "1",
            "links": {
              "self": "/v1/services/1"
            }
          },
          "jsonapi": {
            "version": "1.0"
          },
          "links": {
            "self": "/v1/services/1"
          }
        }


### Update Service [PATCH]
Update a single service by `id` (only admin).

+ `id` (integer) - ID of the record to update **(required)**

+ Request (application/vnd.api+json)

    + Headers

            Authorization: JWT <Auth Key>

    + Body

            {
              "data": {
                "attributes": {
                  "name": "track"
                },
                "id": "1",
                "type": "service"
              }
            }

+ Response 200 (application/vnd.api+json)

            {
                "data": {
                    "attributes": {
                        "name": "track"
                    },
                    "type": "service",
                    "id": "1",
                    "links": {
                        "self": "/v1/services/1"
                    }
                },
                "jsonapi": {
                    "version": "1.0"
                },
                "links": {
                    "self": "/v1/services/1"
                }
            }
